package com.tzy.for10evalue.utils;

import org.apache.poi.ss.usermodel.Workbook;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 起码值1个E的核心代码
 * @author tzy
 * @date 2021/12/16 15:30
 */
public class CommonUtil {
    public static void main(String[] args) throws Exception{
        //网络资源转输入流
        //资源url
        String url="http://xxx.xxx.com/abc";
        HttpURLConnection httpUrl = (HttpURLConnection) new URL(url).openConnection();
        InputStream inputStream = httpUrl.getInputStream();
        httpUrl.connect();

 /*       //easyExcel 生成文件转输入流
        ExcelUtil newExcelUtil = new ExcelUtil(response, "线索导出", DlClueBaseListExportVO.class);
        Workbook wb = newExcelUtil.getWriter().writeContext().writeWorkbookHolder().getWorkbook();
        File file = new File("线索数据表" + System.currentTimeMillis() + ".xlsx");
        OutputStream os = null;
        try {
            os = new FileOutputStream(file);
            wb.write(os);
            os.close();*/

 /*       //按时间排序 为空则靠前
        List page=null;
        Date itemDate=null;
        page.stream().sorted(Comparator.comparing(item->itemDate,Comparator.nullsFirst(Date::compareTo).reversed())).collect(Collectors.toList());*/

    }
}
